package com.yonyou.isv.demo.openapi.api.customer.customertype;

import com.yonyou.isv.demo.openapi.base.module.reponse.ApiDataArrayResponse;
import com.yonyou.isv.demo.openapi.base.module.reponse.ApiDataResponse;
import com.yonyou.isv.demo.openapi.api.BaseOpenApi;
import com.yonyou.isv.demo.openapi.api.OpenApiURL;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @description: 用友客户分类开放平台接口
 * @author: nishch
 * @create: 2021-07-08
 **/
@Component
public class CustomerTypeApi extends BaseOpenApi {

    public Map<String, Object> save(Map<String, Object> params) {
        ApiDataResponse apiDataResponse =  postForEntity(OpenApiURL.CUSTOMER_TYPE_SAVE,params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }

    public Map<String, Object> detail(Map<String, String> params) {
        ApiDataResponse apiDataResponse =  getForEntity(OpenApiURL.CUSTOMER_TYPE_DETAIL,params, ApiDataResponse.class);
        return getData(apiDataResponse);
    }

    public List<Map<String, Object>> list(Map<String, Object> params) {
        ApiDataArrayResponse apiDataResponse =  postForEntity(OpenApiURL.CUSTOMER_TYPE_TREE,params, ApiDataArrayResponse.class);
        return getData(apiDataResponse);
    }
}
